package com.chuangke.runner;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import com.chuangke.admin.service.SysDeptService;
import com.chuangke.admin.service.SysDictService;
import com.chuangke.admin.service.SysDictTypeService;
import com.chuangke.admin.service.SysMenuService;
import com.chuangke.admin.service.SysRoleMenuService;
import com.chuangke.admin.service.SysRoleService;
import com.chuangke.admin.service.SysUserDataDeptService;
import com.chuangke.admin.service.SysUserRoleService;
import com.chuangke.admin.service.SysUserService;

@Component
@Order(1)
public class SysCacheOrderRunner implements CommandLineRunner {

    private static final Logger logger = LoggerFactory.getLogger(SysCacheOrderRunner.class);

    @Autowired
    private SysDictService sysDictService;
    @Autowired
    private SysUserService sysUserService;
    @Autowired
    private SysRoleService sysRoleService;
    @Autowired
    private SysDeptService sysDeptService;
    @Autowired
    private SysUserDataDeptService sysUserDataDeptService;
    @Autowired
    private SysUserRoleService sysUserRoleService;
    @Autowired
    private SysMenuService sysMenuService;
    @Autowired
    private SysRoleMenuService sysRoleMenuService;
    @Autowired
    private SysDictTypeService sysDictTypeService;

    @Override
    public void run(String... args) {
        logger.info("Start loading the cache");
        sysDictTypeService.findMap();
        sysDictService.findAll();
        sysUserService.findMap();
        sysDeptService.findMap();
        sysMenuService.findMap();
        sysUserDataDeptService.findAll();
        sysUserRoleService.findAll();
        sysRoleMenuService.findMap();
        sysRoleService.findList();
        logger.info("Cache load completed");
    }
}